package com.ruoyi.business.service;

import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface IProcessDifinitionService {
    Deployment deployDefinition(String realPath) throws FileNotFoundException;

    ProcessDefinition getProcessDefinitionByDeploymentId(String deploymentId);


    InputStream getProcessDefinitionFileByDeploymentId(Long deploymentId);

    InputStream getProcessDefinitionImageByDeploymentId(Long deploymentId);


    ProcessInstance startProcessDefinition(String definitionKey, String businessKey, HashMap<String, Object> map);

    List<Task> getTaskByInstanceId(String id);

    void setTaskCandidateUser(String id, String valueOf);

    //根据流程实例id获取处理中的流程图
    InputStream getProcessImgByInstanceId(String instanceId);


    void deleteProcessInstance(String instanceId, String s);

    long getCountBydefinitionKey(String definitionKey, String userId);

    List<Task> getTaskByDifinitionKeyAndUserId(String definitionKey, String userId, int startIndex, Integer pageSize);

    ProcessInstance getInstanceById(String processInstanceId);

    Task getTaskById(String taskId);

    void claimAndComment(Task task, boolean auditStatus, String comment);

    //领取并完成任务
    void claimAndComment(String taskId, Map<String, Object> variables, String comment);

    //添加任务批注
    void addTaskComment(String taskId, String instanceId, String comment);

    /**
     * 覆盖指定流程下的流程变量
     * @param taskId
     * @param map
     */
    void setVariables(String taskId, Map<String, Object> map);

    //分页查询以完成任务
    List<HistoricTaskInstance> getFinishedTaskListByInstanceAuditUserId(String definishionKey, String userId,Integer start,Integer pageSize);


        //获取已完成任务总数
    long getFinishedTaskCountByInstanceAuditUserId(String definitionKey, String userId);

    //获取历史流程实例对象
    HistoricProcessInstance getHistoryProcessInstanceByInstanceId(String processInstanceId);

    //根据实例id查询活动对象
    List<HistoricActivityInstance> getHistoricActivityListByInstanceId(String instanceId);

    //根据任务id获取任务批注
    String getTaskCommentByTaskId(String taskId);

}
